home *** CD-ROM | disk | FTP | other *** search
/ VisualFX for ImageFX / VisualFX for Image FX 2.adf / Files / ARexx / 02 / 06.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1996-02-04  |  5.1 KB  |  260 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20. line = readln(TempFile)
  21. Color = strip(line)
  22. line = readln(TempFile)
  23. Type = strip(line)
  24. call close (TempFile)
  25. ActiveColor Color
  26. ActiveColor
  27. j=0
  28. TFrames = Frames
  29. if Field = 1 then TFrames = Frames*2
  30. do i = 1 to Frames
  31.     call open TempFile,"RAM:VFXNums",W
  32.     call writeln TempFile,right(i,5,'0')
  33.     call writeln TempFile,right(Frames,5,'0')
  34.     call close TempFile
  35.     f=0
  36.     Redraw Off
  37.     FieldSet = 0
  38.     if Padding ~= -1 & i = 1 then call PadIt(1)
  39.     call LoadB()
  40.     call LoadA()
  41.     j = j+ 1
  42.     call DoIt()
  43.     Redraw On
  44.     call SaveIt()
  45.         if Field = 1 then do
  46.             Redraw Off
  47.             FieldSet = 1
  48.             call LoadB()
  49.             call LoadA()
  50.             j = j + 1
  51.             call DoIt()
  52.             Redraw On
  53.             call SaveIt()
  54.             end 
  55.     if Padding ~= -1 & i = Frames then call PadIt(2)
  56.     end
  57.     if SaveType = 0 then do
  58.         if Padding = -1 then
  59.             call MakeIcon(SaveName,(Frames-10))
  60.         else
  61.             call MakeIcon(SaveName,(Padding+(Frames-10)))
  62.         end
  63.     ActiveColor 1
  64.     ActiveColor
  65.     Undo On
  66. exit
  67.  
  68.  
  69. PadIt:
  70. arg PadNum
  71.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  72.         Undo On
  73.         exit
  74.         end
  75.          if PadNum = 1 then do
  76.        if IAType = 0 then do
  77.         do Pad = Padding to 1 by -1
  78.             LoadBuffer PicAName Force StartA-(Pad-1)
  79.             call Switcher(TOSW)
  80.             call Switcher(MDV1)
  81.             Render Go
  82.                 call RecordAdd(SaveName,2,6,Compression)
  83.             end
  84.         end
  85.        if IAType = 1 then do
  86.         LoadBuffer PicAName Force 1
  87.         call Switcher(TOSW)
  88.         call Switcher(MDV1)
  89.         Render Go
  90.             call RecordAdd(SaveName,2*Padding,6,Compression)
  91.         end
  92.        if IAType = 2 then do
  93.         LoadBuffer PicAName Force
  94.         call Switcher(TOSW)
  95.         call Switcher(MDV1)
  96.         Render Go
  97.             call RecordAdd(SaveName,2*Padding,6,Compression)
  98.         end
  99.        if IAType = 3 then do
  100.         do Pad = Padding to 1 by -1
  101.             LoadBuffer PicAName""right(StartA-(Pad-1),3,'0') Force
  102.             call Switcher(TOSW)
  103.             call Switcher(MDV1)
  104.             Render Go
  105.                 call RecordAdd(SaveName,2,6,Compression)
  106.             end
  107.         end
  108.     end 
  109.     else do
  110.        if IBType = 0 then do
  111.         do Pad = 1 to Padding
  112.             LoadBuffer PicBName Force StartB+Pad+Frames
  113.             call Switcher(TOSW)
  114.             call Switcher(MDV1)
  115.             Render Go
  116.                 call RecordAdd(SaveName,2,6,Compression)
  117.             end
  118.         end
  119.        if IBType = 1 then do
  120.         LoadBuffer PicBName Force 1
  121.         call Switcher(TOSW)
  122.         call Switcher(MDV1)
  123.         Render Go
  124.             call RecordAdd(SaveName,2*Padding,6,Compression)
  125.         end
  126.        if IBType = 2 then do
  127.         LoadBuffer PicBName Force
  128.         call Switcher(TOSW)
  129.         call Switcher(MDV1)
  130.         Render Go
  131.             call RecordAdd(SaveName,2*Padding,6,Compression)
  132.         end
  133.        if IBType = 3 then do
  134.         do Pad = 1 to Padding
  135.             LoadBuffer PicBName""right(StartB+Pad+Frames),3,'0') Force
  136.             call Switcher(TOSW)
  137.             call Switcher(MDV1)
  138.             Render Go
  139.                 call RecordAdd(SaveName,2,6,Compression)
  140.             end
  141.         end
  142.     end
  143. return
  144.  
  145. LoadA:
  146.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  147.         Undo On
  148.         exit
  149.         end
  150.     if j = TFrames then return
  151.     if IAType = 0 then do
  152.         LoadBuffer PicAName Force i+StartA
  153.         end
  154.     if IAType = 1 then do
  155.         LoadBuffer PicAName Force 1
  156.         end
  157.     if IAType = 2 then do
  158.         LoadBuffer PicAName Force
  159.         end
  160.     if IAType = 3 then do
  161.         LoadBuffer PicAName""right(i+StartA,3,'0') Force
  162.         end
  163.  
  164. return
  165.  
  166. LoadB:
  167.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  168.         Undo On
  169.         exit
  170.         end
  171.     if j = 1 then return
  172.     if IBType = 0 then do
  173.         LoadBuffer PicBName Force i+StartB
  174.         end
  175.     if IBType = 1 then do
  176.         LoadBuffer PicBName Force 1
  177.         end
  178.     if IBType = 2 then do
  179.         LoadBuffer PicBName Force
  180.         end
  181.     if IBType = 3 then do
  182.         LoadBuffer PicBName""right(i+StartB,3,'0') Force
  183.         end
  184.     Swap
  185. return
  186.  
  187.  
  188. DoIt:
  189.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  190.         Undo On
  191.         exit
  192.         end
  193.     if j = TFrames then do
  194.         Swap
  195.         return
  196.         end
  197.     if j = 1 then return
  198.  
  199.  
  200.     Num = (((j-1) * 360)/(TFrames-1))
  201.     FirstNum = trunc(Num)
  202.     if Type = 0 then FirstNum = -FirstNum
  203.  
  204.     Num = (((j-1) * 200)/(TFrames-1))
  205.     SecondNum = trunc(Num-100)
  206.  
  207.  
  208.  
  209.     if j > (TFrames/2) then do
  210.         HorizFlip
  211.         VertFlip
  212.         Hook Composite Merge SecondNum 1 0 0 MatchMain SwapScale 
  213.         end
  214.     else do
  215.         Hook Perspective '0' '0' FirstNum '0' '0' '0' '0' '0' -1 -1 -1 0 DrawColor AntiAlias
  216.     end
  217. return
  218.  
  219. SaveIt:
  220.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  221.         Undo On
  222.         exit
  223.         end
  224.     if SaveType = 0 then do
  225.         call Switcher(TOSW)
  226.         call Switcher(MDV1)
  227.  
  228.         Render Go
  229.         if Field = 1 then
  230.                 call RecordAdd(SaveName,1,6,Compression)
  231.         else
  232.                 call RecordAdd(SaveName,2,6,Compression)
  233.         end
  234.  
  235.     if SaveType = 1 then do
  236.         if Field = 1 then do
  237.             f= f + 1
  238.             if f = 1 then
  239.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  240.             if f = 2 then do
  241.                 GetMain
  242.                 parse var result Name Width Height Blah
  243.                 Scale Width Height/2
  244.                 Swap
  245.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  246.                 Scale Width Height/2
  247.                 Hook Interlace
  248.                 SaveBufferAs ILBM SaveName""right(i,3,'0')
  249.                 f = 0
  250.                 end
  251.             end
  252.         else do
  253.             SaveBufferAs ILBM SaveName""right(i,3,'0')
  254.             end    
  255.         end
  256.  
  257. return
  258.  
  259.  
  260.